/**
 * @param {number} n
 * @return {number}
 */
//f(n) = f(n-1) + f(n-2)
//f(1) = 1
//f(2) = 2
 var climbStairs = function(n) {
    let f = []
    f[1] = 1
    f[2] = 2
    for(let i = 3; i <= n; i++) {
        f[i] = f[i - 1] + f[i -2]
    }
    return f[n]
};

console.log(climbStairs(4))